//
//  BaseTextViewCell.m
//  QuDanOEM
//
//  Created by wmz on 2021/11/7.
//

#import "BaseTextViewCell.h"

@implementation BaseTextViewCell
- (void)hd_setupViews{
    @HDWeakify(self)
    self.textView.block = ^(id  _Nullable data) {
        @HDStrongify(self)
        if ([NSStringFromClass(self.model.class) isEqualToString:@"BaseCellModel"]) {
            self.model.detail = self.textView.text;
         }
    };
    
    self.textView.endEditBlock = ^(id  _Nullable data) {
        @HDStrongify(self)
        [GNEvent eventResponder:self target:data key:@"textViewEndAction" indexPath:self.model.indexPath info:@{@"data":self.model}];
    };
}
- (void)setGNModel:(BaseCellModel*)data{
    self.model = data;
    self.nameLB.add_font(data.titleFont).add_text(data.title).add_textColor(data.titleColor);
    
    if (data.imageTitle)
        self.textView.placeHolder = data.imageTitle;
    self.textView.add_text(data.detail).add_textColor(data.detailColor).add_font(data.detailFont);
    
    self.leftLayout.constant = data.title ? 14:0;
    self.heighLayout.constant = data.width ? : 120;

}

@end
